package Day5Zuoye;

import java.io.*;

public class TestF2 {
    public static void main(String[] args) {
        BufferedWriter bw=null;
        try {
            bw=new BufferedWriter(new FileWriter("C:\\Users\\Administrator\\Desktop\\xinjian\\pet.txt"));
            int count=0;
            for (int i=1;i<10000;i++){
                //i是不是质数
                int j=2;
                while(j*j<=i&&i%j!=0){
                    j++;
                }
                if (j*j>i){
                   bw.write(i+" ");
                   count++;
                    if(count%10==0){
                        bw.newLine();
                     }
                    }
                }
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                bw.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
